package com.xuecheng.content.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xuecheng.content.model.dto.TeachplanDto;
import com.xuecheng.content.model.po.Teachplan;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 课程计划 Mapper 接口
 * </p>
 *
 * @author itcast
 */
public interface TeachplanMapper extends BaseMapper<Teachplan> {

    //查询某课程的课程计划，组成树形接口
    public List<TeachplanDto> selectTreeNodes(Long course);

    //根据父节点id查询子节点
    @Select("select * from teachplan where parentid=#{id}")
    public List<Teachplan> selectByParentid(Long id);

    @Select("select * from teachplan where course_id=#{courseId}")
    List<Long> selectByCourseId(Long courseId);


    @Delete("delete from teachplan where course_id = #{id}")
    void deleteByCourseId(Long id);
}
